<%@ Application Language="C#" %>

<script runat="server">

	void Application_Start(object sender, EventArgs e) {
		SiteMap.SiteMapResolve += AppendQueryString;
//		if (!Roles.RoleExists("Administrators")) Roles.CreateRole("Administrators");
//		if (!Roles.RoleExists("Friends")) Roles.CreateRole("Friends");
	}

    static SiteMapNode AppendQueryString(object o, SiteMapResolveEventArgs e)
    {
        if (SiteMap.CurrentNode != null) {
		    var temp = SiteMap.CurrentNode.Clone(true);
			var u = new Uri(e.Context.Request.Url.ToString());
			temp.Url += u.Query;
			if (temp.ParentNode != null) {
				temp.ParentNode.Url += u.Query;
			}
			return temp;
		}
        return null;
    }

</script>
